const Mock = require('mockjs')

const AppointFollowList=[];
for(let i=0;i<100;i++){
    AppointFollowList.push(
        Mock.mock({
            id:'@increment',
            licenseplate:'@integer(10000,99999)',
            carname:'@first',
            carcolor:'@color',
            buyinshop:'@integer(0,1)',
            customername:'@first',
            customerphone:'@integer(13500001111,13790001111)',
            productiondate:'@datetime',
            repairtype:'@first',
            keepfit:'@first',
            taker:'@first',
            state:'@integer(0,3)',
            remark:'@remark',
            appointtime:'@datetime',
            appointguider:'@first',
            revisitcount:'@integer(0,10)',
            createtime:'@datetime',
        })
    )
}

const AppointDoingList=[];
for(let i=0;i<100;i++){
    AppointDoingList.push(
        Mock.mock({
            id:'@increment',
            licenseplate:'@integer(10000,99999)',
            carname:'@first',
            carcolor:'@color',
            customername:'@first',
            customerphone:'@integer(13500001111,13790001111)',
            appointdate:'@datetime',
            appointfitdate:'@datetime',
            repairtype:'@first',
            repairtype2:'@first',
            state:'@integer(0,3)',
            remark:'@remark',
            appointguider:'@first',
            createtime:'@datetime',
        })
    )
}

module.exports=[
    {
        url: '/api/aftersale/appointfollow',
        type: 'get',
        response: config => {
          const { name, page = 1, limit = 20, sort } = config.query
    
          let mockList = AppointFollowList.filter(item => {
            return true
          })

    
          const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
    
          return {
            code: '10000',
            data: {
              total: mockList.length,
              items: pageList
            }
          }
        }
    },
    {
        url: '/api/aftersale/appointdoing',
        type: 'get',
        response: config => {
          const { name, page = 1, limit = 20, sort } = config.query
    
          let mockList = AppointDoingList.filter(item => {
            return true
          })

    
          const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
    
          return {
            code: '10000',
            data: {
              total: mockList.length,
              items: pageList
            }
          }
        }
    },
]